﻿using System;
using System.Collections.Generic;
using System.Drawing;
//using System.Linq;
using System.Text;
//using System.Threading.Tasks;
using TRicheControl.DefaultControlStyles.Helper;
using TRicheControl.Interface.ControlStyle;
using TRicheControl.WinformControl;

namespace TRicheControl.DefaultControlStyles
{
    public class TreeViewStyle : ITreeViewStyle
    {
        private Pen mEnableTreeViewBorderPen;

        private Pen mTreeNodeBorderPen;

        public TreeViewStyle()
        {
            mEnableTreeViewBorderPen = new Pen(Color.DarkGray);
            mTreeNodeBorderPen = new Pen(Color.DarkGray);
        }

        public void DrawEnbaleTreeView(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            DrawHelper.SetGraphics(g);
            rect.Width -= (int)mEnableTreeViewBorderPen.Width;
            rect.Height -= (int)mEnableTreeViewBorderPen.Width;
            g.DrawRectangle(mEnableTreeViewBorderPen, rect);
        }

        public void DrawUnEnbaleTreeView(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
        }

        public void DrawTreeNode(RicheTreeNode node,Graphics g)
        {
            if (node.Font == null)
            {
                node.Font = SystemFonts.DefaultFont;
            }
            if (node.IsFocused)
            {
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 0, 122, 204)), node.Bounds);
                g.DrawString(node.Text, node.Font, new SolidBrush(Color.White), node.Bounds);
            }
            else
            {
                g.DrawString(node.Text, node.Font, new SolidBrush(Color.Black), node.Bounds);
            }
        }

        public void DrawExpandNode(RicheTreeNode node, Graphics g)
        {
            
        }

        public void DrawUnExpandNode(RicheTreeNode node, Graphics g)
        {
           
        }
        
        public void DrawMouseDownNode(RicheTreeNode node, Graphics g)
        {
            
        }
    }
}
